package inc.gome.dynamic.datasource.service.impl;


import inc.gome.dynamic.datasource.service.MasterService;
import inc.gome.dynamic.datasource.service.SlaveService;
import inc.gome.dynamic.datasource.service.TranstationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/*测试多数据源事务*/
@Service
public class TranstationServiceImpl implements TranstationService {



    @Autowired
    private MasterService masterService;


    @Autowired
    private SlaveService slaveService;



    /**
     * 开启事务
     */
    @Override
//    @Transactional  //开启事务


    public void testTranstation(String  name) {
        //master数据源
        masterService.updateById(760485,name+"_M");

        //slave 数据源
        slaveService.updateById(15,name+"_S");
    }
}
